<div class="layui-form" lay-filter="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
  
  <script type="text/html" template lay-done="layui.data.done(d.params);">
  <input type="text" name="roleId" value="{{ d.params.roleId || '' }}" style="display: none;" class="layui-input">
  </script>

  <div class="layui-form-item">
    <label class="layui-form-label">角色</label>
    <div class="layui-input-block">
      <script type="text/html" template>
        {{# if(d.params.roleName != null && d.params.roleName == "管理员") { }}
        <input type="text" name="roleName" readonly value="{{ d.params.roleName || '' }}" lay-verify="required"
          placeholder="请输入角色名" autocomplete="off" class="layui-input">
        {{# } else { }}
        <input type="text" name="roleName" value="{{ d.params.roleName || '' }}" lay-verify="required"
          placeholder="请输入角色名" autocomplete="off" class="layui-input">
        {{# } }}
      </script>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">权限范围</label>

    <div style="height: 220px; overflow: auto;" id="toolbarDiv">
      <ul id="demoTree" class="dtree" data-id="0"></ul>
    </div>

  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">具体描述</label>
    <div class="layui-input-block">
      <script type="text/html" template>
        <textarea type="text" name="description" lay-verify="required" autocomplete="off"
          class="layui-textarea">{{ d.params.description || '' }}</textarea>
      </script>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-inline">
      <input type="button" lay-submit lay-filter="LAY-user-role-submit" value="确认" class="layui-btn">
    </div>
  </div>
</div>

<script>
  layui.data.done = function (d) {
    layui.use(['admin', 'form'], function () {
      var $ = layui.$,
        form = layui.form;

        $(document).ready(function () {
          d.roleName = "管理员"
        });


    });
  }
</script>